package cn.taobaoke.restful.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangzuo
 * @since 2017-05-05 05:32
 */
@RestController
@RequestMapping("/api/error")
public class ErrorController extends BaseController {

    @GetMapping("")
    public Result errorMsg(@RequestParam("msg") String msg) {
        logger.warn("错误的请求: {}", msg);
        Result result = new Result();
        result.put("success", false);
        result.put("message", msg);
        return result;
    }

    private static Logger logger = LogManager.getLogger(ErrorController.class);
}
